package com.guli.seckill.exception;

import com.guli.common.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @Author zzb
 * @Date 2024/8/1 19:43
 * @Version 1.0
 * @description
 */
@Component
@Slf4j
public class IsBoughtException extends RuntimeException {
    private static final long serialVersionUID = -2536309033892090392L;

    public IsBoughtException() {
        super();
    }

    public IsBoughtException(String message) {
        super(message);
    }

    @ExceptionHandler(IsBoughtException.class)
    public R handleIsBoughtException(Exception ex) {
        log.info(ex.getMessage());
        return R.error("用户已经购买过该商品");
    }
}
